/**
 * 1
 *  
 * @Author : Ruoyu Wang
 * @DateTime : 24-9-22 下午6:59
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> edges[n + 1];
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    long long res = 0;
    for (int u = 1; u <= n; ++u) {
        for (auto w: edges[u]) {
            if (w != u) {
                res += edges[w].size();
            }
        }
    }
    cout << res / 2 - n + 1;
    return 0;
}